/*
 * Records package
 */
package edu.gatech.oad.records;
import java.util.ArrayList;
import java.util.List;

import edu.gatech.oad.persistence.PersistentObject;
import edu.gatech.oad.user.Patient;
/**
 * Stores the patients medical history including each treatment 
 * record, all lab results, and a brief medical profile
 * @author Nathan Hurley
 * @version 1.0 3/6/11
 *
 */
public class PatientHistory extends PersistentObject {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * List of TreatmentRecords to keep track of patients
	 * medical history
	 */
	private List<TreatmentRecord> treatmentRecords;
	
	/**
	 * List of LabResults the patient has received
	 */
	private List<LabResults> labRecords;
	
	/**
	 * Brief description of the patients medical history
	 */
	private String medicalProfile;
	
	/**
	 * The Patient that has this PatientHistory
	 */
	private Patient curPatient;
	
	/**
	 * Default PatientHistory constructor
	 */
	public PatientHistory(){
		treatmentRecords = new ArrayList<TreatmentRecord>();
		labRecords = new ArrayList<LabResults>();
		medicalProfile = null;
	}
	
	/**
	 * Construct a PatientHistory for a given Patient
	 * @param curPatient patient to build history for
	 */
	public PatientHistory(Patient curPatient){
		this();//call default constructor
		this.curPatient = curPatient;
	}
	
	/**
	 * @return the Patient associated with the PatientHistory
	 */
	public String getPatient(){
		return curPatient.getFirstName() + " " + curPatient.getLastName();
	}
	
	/**
	 * @return  short description of the patients medical history
	 */
	public String getMedicalProfile(){
		return medicalProfile;
	}
	
	/**
	 * @param medicalProfile new medical profile
	 */
	public void setMedicalProfile(String medicalProfile){
		this.medicalProfile = medicalProfile;
	}
	
	/**
	 * @return  all of the patients Treatment Records
	 */
	public List<TreatmentRecord> getTreatmentRecords(){
		return treatmentRecords;
	}
	
	/**
	 * @param treatmentRecords  new set of treatment records for the patient
	 */
	public void setTreatmentRecords(List<TreatmentRecord> treatmentRecords){
		this.treatmentRecords = treatmentRecords;
	}
	
	/**
	 * @return  all of the patients lab results
	 */
	public List<LabResults> getLabResults(){
		return labRecords;
	}
	
	/**
	 * @param labRecords  new set of lab results for the patient
	 */
	public void setLabResults(List<LabResults> labRecords){
		this.labRecords = labRecords;
	}
	
	/**
	 * @param newRecord  new treatment record to add to the patients medical history
	 */
	public void addTreatmentRecord(TreatmentRecord newRecord){
		treatmentRecords.add(newRecord);
	}
	
	/**
	 * @param toRemove  the treatment record to remove
	 */
	public void removeTreatmentRecord(TreatmentRecord toRemove){
		treatmentRecords.remove(toRemove);
	}
	
	/**
	 * @param newLab the new lab record to add to the patients medical history
	 */
	public void addLabRecord(LabResults newLab){
		labRecords.add(newLab);
	}
	
	/**
	 * @param toRemove  the lab record to remove
	 */
	public void removeLabRecord(LabResults toRemove){
		labRecords.remove(toRemove);
	}
	
	/**
	 * @return the Patients first and last name followed by their medicalProfile
	 */
	public String toString(){
		return curPatient.getFirstName() + " " + curPatient.getLastName() 
		+ " " + getMedicalProfile();
	}
}
